}
/**
- * @dataProvider dataSelectSQLText
+ * @dataProvider dataSQL
*/
- function testSelectSQLText( $sql, $sqlText ) {
+ function testSQL( $sql, $sqlText ) {
$this->assertEquals( trim( $this->db->selectSQLText(
isset( $sql['tables'] ) ? $sql['tables'] : array(),
isset( $sql['fields'] ) ? $sql['fields'] : array(),
) ), $sqlText );
}
- function dataSelectSQLText() {
+ function dataSQL() {
return array(
array(
array(
),
);
}
-
- /**
- * @dataProvider dataConditional
- */
- function testConditional( $sql, $sqlText ) {
- $this->assertEquals( trim( $this->db->conditional(
- $sql['conds'],
- $sql['true'],
- $sql['false']
- ) ), $sqlText );
- }
-
- function dataConditional() {
- return array(
- array(
- array(
- 'conds' => array( 'field' => 'text' ),
- 'true' => 1,
- 'false' => 'NULL',
- ),
- "(CASE WHEN field = 'text' THEN 1 ELSE NULL END)"
- ),
- array(
- array(
- 'conds' => 'field=1',
- 'true' => 1,
- 'false' => 'NULL',
- ),
- "(CASE WHEN field=1 THEN 1 ELSE NULL END)"
- ),
- );
- }
}
\ No newline at end of file